import java.util.;
 
public class Same {
    public boolean checkSam(String stringA, String stringB) {
     
                if (stringA.length() != stringB.length()) {
            return false;
        }
        int[] arr1 = new int[256];
        int[] arr2 = new int[256];
        for (int i = 0, end = stringA.length(); i  end; i++) {
            arr1[stringA.charAt(i)]++;
        }
        for (int i = 0, end = stringB.length(); i  end; i++) {
            arr2[stringB.charAt(i)]++;
        }
        for (int i = 0; i  arr1.length; i++) {
            if (arr1[i] != arr2[i]) {
                return false;
            }
        }
        return true;
    }
}